﻿using AutoMapper;
using MediatR;
using S.Breeding.Domain;
using S.Breeding.Infrastructure;
using S.Breeding.Read.Api.Application.Command.SheepWeighCommand;

namespace S.Breeding.Read.Api.Application.CommandHandlers.SheepWeighCommandHandlers
{
    public class SheepWeighEditCommandHandlers : IRequestHandler<SheepWeighEditCommand, SheepWeigh>
    {
        private readonly IRepository<SheepWeigh> repository;
        private readonly IMapper mapper;
        public SheepWeighEditCommandHandlers(IRepository<SheepWeigh> repository, IMapper mapper)
        {
            this.repository = repository;
            this.mapper = mapper;
        }

        public async Task<SheepWeigh> Handle(SheepWeighEditCommand request, CancellationToken cancellationToken)
        {
            return await repository.GetAsync(request.SwID);
            //return repository.Get(request.SwID);
        }
    }
}
